package net.alche.sdd.fatis;

import java.util.List;
import java.util.Map;

@SuppressWarnings("all")
public class SddDao extends SddFatisDao {
  public SddFatis fatis = null;

  // new Macro
  public SddFatisMacro mc(String sql) {
    return new SddFatisMacro(sql);
  }

  public SddFatisMacro mc(String sql, Map<String, Object> map) {
    return new SddFatisMacro(sql, map);
  }

  public List doSelectList(Class cls, SddFatisMacro macro) {
    return fatis.getStatement().selectList(macro.getSql(), cls, macro.getPreparedList());
  }

  public <T> T doSelectOne(Class cls, SddFatisMacro macro) {
    return fatis.getStatement().selectOne(macro.getSql(), cls, macro.getPreparedList());
  }

  public Integer doInsert(String colAutoId, SddFatisMacro macro) {
    macro.setAutoIdCol(colAutoId);
    return fatis.getStatement().insert(macro.getSql(), macro.getPreparedList(), macro);
  }

  public Integer doUpdate(SddFatisMacro macro) {
    return fatis.getStatement().update(macro.getSql(), macro.getPreparedList());
  }

  public Integer doDelete(SddFatisMacro macro) {
    return fatis.getStatement().delete(macro.getSql(), macro.getPreparedList());
  }

  public void setFatis(SddFatis fatis) {
    this.fatis = fatis;
  }
}
